package day5;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class Zuihouzhouliu {
    public static void main(String[] args) {
        SimpleDateFormat sr = new SimpleDateFormat("yyyy-MM-dd hh:mm");
        Calendar c = Calendar.getInstance();
        Scanner input = new Scanner(System.in);
        System.out.println("输入年份:");
        int y = input.nextInt();

        for(int i=0;i<12;i++){
            c.set(y, i, 1, 8, 0);
            //
            c.set(Calendar.DAY_OF_MONTH,c.getActualMaximum(Calendar.DAY_OF_MONTH));

            //设到最后一个周六
            //c.set(Calendar.SATURDAY,c.getActualMaximum(Calendar.SATURDAY));
            if(c.get(Calendar.DAY_OF_WEEK)==Calendar.SATURDAY){
                c.add(Calendar.DAY_OF_MONTH,-7);
            }else{
                int cha=c.get(Calendar.DAY_OF_WEEK);
                c.add(Calendar.DAY_OF_MONTH,-cha-7);
            }
            System.out.println(c.getTime());
        }
    }
}
